define(function (require, exports, module) {

	var $ = require('$');
		require('bootstrap-notify');

	if ( typeof  $.notifyDefaults == 'function' ) {
		$.notifyDefaults({
			type : 'info',
			allow_dismiss : true,//关闭按钮
			placement : {//位置
				from : "top",
				align : "center"
			},
			delay : 500,
			timer : 800,//动画时间
			animate : {//动画效果
				enter : 'animated fadeInDown',
				exit : 'animated fadeOutUp'
			}
		})
	}

	//表单提交
	exports.ajaxForm = function(ajaxFrom){
		ajaxFrom.ajaxForm({
			dataType:'json',
			success:function(data){
				if(data.status == 1 && data.url){
					$.notify(data.message, {type : 'success'});
					setTimeout(function(){
						window.location.href = data.url;
					},1000);
					return true;
				}
				$.notify(data.message, {type : 'danger'});
			}
		});

	}

});